package com.mq.retry;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 发送消息
 * @author ytj
 * @date 2024/1/16
 */
@Component
public class Demo7Producer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(Integer id) {
        System.out.println("发送消息:"+id);
        Demo7Message demo7Message=new Demo7Message(id);
        this.rabbitTemplate.convertAndSend(Demo7Message.EXCHANGE,Demo7Message.ROUTINGKEY,demo7Message);
    }
}
